import 'dart:convert' as convert;

import 'package:flutter/material.dart';
import 'package:village_android/component/icon_tile.dart';
import 'package:village_android/pages/monitor/monitor_report_manager_page.dart';
import 'package:qrscan/qrscan.dart' as scanner;

class MonitorReportSelectPage extends StatefulWidget {
  @override
  _MonitorReportSelectPageState createState() =>
      _MonitorReportSelectPageState();
}

class _MonitorReportSelectPageState extends State<MonitorReportSelectPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text("管理员监督"),
        ),
        body: Container(
          child: Column(
            children: <Widget>[
              Container(height: 8.0, color: Colors.black12),
              Divider(height: 2.0, color: Colors.black38),
              IconTile(
                  leading: Icons.compare_arrows, title: "扫描门牌二维码自动填写地址", action: () async {

                String cameraScanResult = await scanner.scan();
//                String photoScanResult = await scanner.scanPhoto();
                if(cameraScanResult!=null) {
                  var page = new MonitorReportManagerPage();
                  Navigator.push(context, new MaterialPageRoute(builder: (context) => page));
                }

              }),
              Divider(height: 2.0, color: Colors.black38),
              IconTile(leading: Icons.add_location, title: "手动填写地址", action: () {
                var page = new MonitorReportManagerPage();
                Navigator.push(context, new MaterialPageRoute(builder: (context) => page));
              }),
            ],
          ),
        ),
      ),
    );
  }

}
